<?php
$this->breadcrumbs=array(
	Yii::t('base','Agent Companies')=>array('admin'),
	Yii::t('base','Manage'),
);

$this->menu=array(
	array('label'=>'List AgentCompany', 'url'=>array('index')),
	array('label'=>'Create AgentCompany', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('agent-company-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1><?php echo Yii::t('base','Manage Agent Companies');?></h1>

<?php 
echo Yii::t('base','<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>');
?>


<?php echo CHtml::link(Yii::t('base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'agent-company-grid',
	'dataProvider'=>$model->search(),
	'itemsCssClass'=>'responsive table table-striped table-bordered',
	'pagerCssClass'=>'pagination pull-right',
	'cssFile'=>false,
	'columns'=>array(
		'agent_id',
		'agent_number',
		'user_id',
		'name',
		'phone',
		'email',
		array(
			'class'=>'CButtonColumn',
			'header'=>Yii::t('base','Operate'),
			'updateButtonImageUrl'=>array('class'=>'gicon-edit'),
			'updateButtonOptions'=>array('class'=>'btn btn-small'),
			'deleteButtonImageUrl'=>array('class'=>'gicon-edit'),
			'deleteButtonOptions'=>array('class'=>'btn btn-inverse btn-small'),
			'viewButtonImageUrl'=>array('class'=>'gicon-edit'),
			'viewButtonOptions'=>array('class'=>'btn btn-small'),
			'template'=>'{delete}{update}{Distribution Equipment}{Recharge}{view}',
			'buttons'=>array(
				'Distribution Equipment'=>array(
							'label'=>Yii::t('base','Distribution Equipment'),
							'url'=>'Yii::app()->createUrl("userService/AgentDistribution",array("user_id"=>$data->user_id))',
							'options'=>array('class'=>'btn btn-small'),
					),
				'Recharge'=>array(
					'label'=>Yii::t('base','Recharge'),
					'url'=>'Yii::app()->createUrl("AgentRecharge/create",array("user_id"=>$data->user_id,"agent_id"=>$data->agent_id))',
					'options'=>array('class'=>'btn btn-small'),
),
		),
		),
	),
)); ?>
